package com.oj.api.auth.service;

import com.oj.api.auth.AuthAPI;
import com.oj.api.auth.domain.AccountInfo;
import com.oj.api.auth.domain.ForgetInfo;
import com.oj.api.auth.domain.HomeResourceInfo;
import com.oj.api.auth.domain.RoleInfo;
import com.oj.common.IServiceLayer;
import com.oj.common.exception.BreezeeException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 账号服务的接口
 * 1. 密码验证，获取账号的角色，组织
 * 2. 账号查询，修改
 *
 * @author LX
 * @date 2017/7/8
 */
@FeignClient(value = AuthAPI.APPID, path = "/" + AuthAPI.BEAN_ACCOUNT_SERVICE)
public interface IAccountService extends IServiceLayer {

    /**
     * 密码校验
     *
     * @param accountInfo 参数
     * @throws BreezeeException 异常信息
     */
    @RequestMapping(method = RequestMethod.POST, value = AuthAPI.LOGIN)
    AccountInfo checkPassword(@RequestBody AccountInfo accountInfo) throws BreezeeException;

    /**
     * 保存注册信息
     * @param accountInfo
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/saveAccountInfo")
    AccountInfo saveAccountInfo(AccountInfo accountInfo);

    /**
     * 创建角色
     * @param roleInfo
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/createRole")
    RoleInfo createRole(RoleInfo roleInfo);

    /**
     * 忘记密码发送邮件
     * @param accountInfo
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/foegetPw")
    ForgetInfo forgetPw(AccountInfo accountInfo);

    /**
     * 通过code查找信息
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/findForgetInfoById/{id}")
    ForgetInfo findForgetInfoById(@PathVariable("id") String id);

    /**
     * 重置密码
     * @param accountInfo
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/resetPassword")
    AccountInfo resetPassword(AccountInfo accountInfo);

    /**
     * 考试登录
     * @param accountInfo
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/examLogin")
    AccountInfo examLogin(AccountInfo accountInfo);

    /**
     * 通过id查找账户信息
     * @param id
     * @return
     */
    @GetMapping("/findAccountInfoById/{id}")
    AccountInfo findAccountInfoById(@PathVariable("id") String id);

    /**
     * 拿到账户集合
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/accountList")
    List<AccountInfo> getAccountList(AccountInfo accountInfo);
    /**
     * 拿到角色集合
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/findRoleList")
    List<RoleInfo> getRoles(RoleInfo roleInfo);


    /**
     * 绑定学号
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/bindStudentCode")
    AccountInfo bindStudentCode(AccountInfo accountInfo);
    /**
     * 保存homeResource信息
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/saveHomeResource")
    HomeResourceInfo saveHomeResource(HomeResourceInfo homeResourceInfo);
    /**
     * 得到homeResource信息
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/getHomeResource")
    List<HomeResourceInfo> getHomeResource(HomeResourceInfo homeResourceInfo);
}



